<?php

namespace App\Http\Controllers\Web\Discuz;

use Illuminate\Http\Request;
use App\Http\Controllers\Web\Controller;


class IndexController extends Controller
{
    const bbs_web_site = 'http://bbs.tongwei.cn';

    /**
     * discuz 路由地址重定向到 bbs.tongwei.cn 兼容性保留的 discuz 服务器
     *
     * @return \Illuminate\Routing\Redirector
     */
    public function index(Request $request)
    {
        $url = $request->getRequestUri();
        $full_url = self::bbs_web_site . $url;

        return redirect($full_url);
    }

    /**
     * discuz 附件文件路由地址重定向到 bbs.tongwei.cn 兼容性保留的 discuz 服务器
     *
     * @return \Illuminate\Routing\Redirector
     */
    public function getDataAttach($ym, $d, $filename, Request $request)
    {
        $url = $request->getRequestUri();
        $full_url = self::bbs_web_site . $url;

        return redirect($full_url);
    }

}